const mongoose = require('mongoose');

// 根据环境选择数据库端口
const dbPort = process.env.NODE_ENV === 'prod' ? '40802' : '27017';
const dbUri = `mongodb://localhost:${dbPort}/MyBlog`;

console.log(`📦 连接数据库: ${dbUri}`);
mongoose.connect(dbUri); // 连接数据库





